import request from '@/utils/request'

// 查询交易策略统计数据
export const getStrategyStatistics = (params) => {
  return request({
    url: '/v1/departmentWork/strategy/statistics/',
    method: 'get',
    params
  })
}

// 查询统计的图形配置
export const getStrategyStChart = (params) => {
  return request({
    url: '/v1/departmentWork/strategy/statisticsChart/',
    method: 'get',
    params
  })
}

// 获取交易策略数据
export const getStrategy = (params) => {
  return request({
    url: '/v1/departmentWork/strategy/',
    method: 'get',
    params
  })
}

// 发布策略
export const publishStrategy = (data) => {
  return request({
    url: '/v1/departmentWork/strategy/',
    method: 'post',
    data
  })
}

// 删除策略
export const deleteStrategy = (sid) => {
  return request({
    url: '/v1/departmentWork/strategy/',
    method: 'delete',
    params: { sid }
  })
}

// 策略行情审查
export const examineStrategy = (data) => {
  return request({
    url: '/v1/departmentWork/strategy/examine/',
    method: 'put',
    data
  })
}

// 用户获取自己的策略
export const getMyStrategy = (params) => {
  return request({
    url: '/v1/departmentWork/strategy/my/',
    method: 'get',
    params
  })
}
// 策略修改(策略开仓)
export const openMyStrategy = (data) => {
  return request({
    url: '/v1/departmentWork/strategy/my/open/',
    method: 'put',
    data
  })
}

// 策略修改(策略平仓)
export const closeMyStrategy = (data) => {
  return request({
    url: '/v1/departmentWork/strategy/my/close/',
    method: 'put',
    data
  })
}
// 查询个人策略统计
export const tjMyStrategy = () => {
  return request({
    url: '/v1/departmentWork/strategy/my/tj/',
    method: 'get'
  })
}

// 查询策略产品列表
export const getStrategyProduct = () => {
  return request({
    url: '/v1/departmentWork/strategy/product/',
    method: 'get'
  })
}

// 新增策略产品
export const createStrategyProduct = (data) => {
  return request({
    url: '/v1/departmentWork/strategy/product/',
    method: 'post',
    data
  })
}

// 向策略产品添加策略
export const productManageStrategy = (data) => {
  return request({
    url: '/v1/departmentWork/strategy/product/addStrategy/',
    method: 'post',
    data
  })
}

// 查询在/不在产品内的策略
export const productStrategy = (params) => {
  return request({
    url: '/v1/departmentWork/strategy/product/strategy/',
    method: 'get',
    params
  })
}

// 查询策略产品的成功率
export const productStrategySuccess = (params) => {
  return request({
    url: '/v1/departmentWork/strategy/product/successRate/',
    method: 'get',
    params,
  })
}

// 按方式查询策略的月份统计数量
export const ssMonthly = async (params) => {
  return request({
    url: '/v1/departmentWork/strategy/statisticsMonthly/',
    method: 'get',
    params,
  })
}

// 获取近期的成功率统计
export const RecentlySummary = (days) => {
  return request({
    url: '/v1/departmentWork/strategy/recentDaysSuccessRate/',
    method: 'get',
    params: { days },
  })
}
